home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / basic / qbfaqr01.zip / RWSTAT.BAS < prev    next >
BASIC Source File  |  1992-08-10  |  2KB  |  54 lines

  1. 'Date: 06-21-92 (03:03)
  2. 'From: NICK DAVIS
  3. 'Subj: READ/WRITE STATUS CONTEST
  4. '-------------------------------------------------------------------------
  5. 'Unfortunately, the response to our contest was less than overwhelming.
  6. 'Dunno if 1) It was too hard; 2) It was too easy; 3) The time was too
  7. 'short; 4) The prizes weren't enough of a lure; or, 5) None of the
  8. 'above.  Therefore, the Prize Committee will hold the prizes in
  9. 'abeyance and the Competition Committee will attempt to think up a
  10. 'better contest.  As a partial consolation to those who showed
  11. 'interest, following is one routine which works with either QB or PDS
  12. 'plus Crescent's QuickPak and does most if not all of the contest's
  13. '"ReadStatus" routine with having to resort to ON ERROR.  It can be
  14. 'adapted to QB or PDS without QuickPak if you're willing to use ON
  15. 'ERROR or ON LOCAL ERROR plus it works with both MS-DOS and DR DOS.
  16.  
  17. DEFINT A-Z
  18. '
  19. '---------------------------------------------------------------------
  20. '
  21. '         == Report if a Directory Exists ==
  22. '
  23. '         Uses the Following Routines from QuickPak Professional:
  24. '
  25. '              * FUNCTION DOSError ()
  26. '              * FUNCTION GetDir$ (a$)
  27. '              * FUNCTION GetDrive ()
  28. '              * SUB CDir (a$)
  29. '              * SUB SetDrive (a$)
  30. '
  31. '---------------------------------------------------------------------
  32. '
  33. FUNCTION ValidDir (Directory$) STATIC
  34. '
  35.      ValidDir = 0'---------------------------- Assume Not Valid
  36.      DriveNow$ = CHR$(GetDrive)
  37.      DirNow$ = DriveNow$ + ":" + GetDir$(DriveNow$)
  38.      OldDrive = NOT DOSError
  39.      SetDrive Directory$
  40.      IF NOT DOSError THEN '------------------- Drive is Valid
  41.           Current$ = LEFT$(Directory$, 2) + GetDir$(Directory$)
  42.           IF NOT DOSError THEN '-------------- Drive is Readable
  43.                CDir Directory$
  44.                IF NOT DOSError THEN '--------- Directory Exists
  45.                     ValidDir = -1
  46.                     CDir Current$
  47.                END IF
  48.           END IF
  49.      END IF
  50.      SetDrive DriveNow$
  51.      IF OldDrive THEN CDir DirNow$
  52. '
  53. END FUNCTION
  54.